package com.yhb.channel.impl.SXY.ResponseParser.impl;

import com.yhb.channel.impl.SXY.ResponseParser.SXYResponseParser;
import com.yhb.channel.impl.SXY.SXYConstant;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
public class BindCardConfirmResponse extends SXYResponseParser {
    private String agreementNo; // 绑卡成功后返回的协议号，此参数用于下单接口时传入 agreementNo 参数
    public enum BindStatus {
        SUCCESS,
        FAILED,
        FAIL
    }
    private BindStatus bindStatus;
    private String userId;

    @Override
    public boolean isOk() {
        return Status.SUCCESS.equals(this.getStatus()) &&
                BindStatus.SUCCESS.equals(this.bindStatus);
    }

    public boolean isSmsExpiredError() {
        return Status.SUCCESS.equals(this.getStatus()) &&
                !BindStatus.SUCCESS.equals(this.bindStatus) &&
                this.getErrorMessage().startsWith(SXYConstant.SMS_EXPIRED_ERROR_CODE);
    }
}
